package com.example.activity_03;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

/**
 * Created by 居伦昶 on 2018/4/14.
 */

/**
 * 取得Intent的传递的值
 * 计算
 * 显示
 */
public class resultActivity extends Activity {
    private TextView resultView;
    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);
        resultView=(TextView)findViewById(R.id.result);
        Intent intent=getIntent();
        String a=intent.getStringExtra("one");
        String b=intent.getStringExtra("two");
        int aInt=Integer.parseInt(a);//把字符串数据改为整数类型
        int bInt=Integer.parseInt(b);
        int result=aInt*bInt;
        resultView.setText(result+" ");//JAVA中，两边有一个字符串就能把前面的整数改为字符串
    }

}
